#!/bin/bash
# Author: Redbrother
# Email: 728083668@qq.com
# WebSite: https://help.ubuntu.com/community/LiveCDCustomizationFromScratch
# license: None
if [ "`whoami`" != "root" ]; then
	echo "User must be root 需要root权限."
	exit 0
fi
############################################
sed -i 's/security.debian.org/mirrors.163.com/' /etc/apt/sources.list
apt-get update
apt-get install sudo bash-completion wget curl rsync gnupg2 --yes
export LANG=C.UTF-8
export DEBIAN_FRONTEND=noninteractive
export APT_LISTCHANGES_FRONTEND=none
wget -O "/etc/apt/trusted.gpg.d/openmediavault-archive-keyring.asc" https://packages.openmediavault.org/public/archive.key
apt-key add "/etc/apt/trusted.gpg.d/openmediavault-archive-keyring.asc"
echo "deb https://packages.openmediavault.org/public usul main" >  /etc/apt/sources.list.d/openmediavault.list
echo "deb https://openmediavault.github.io/packages/ usul main" >>  /etc/apt/sources.list.d/openmediavault.list

apt-get update
apt-get --yes --auto-remove --show-upgraded --allow-downgrades --allow-change-held-packages --no-install-recommends --option Dpkg::Options::="--force-confdef" --option DPkg::Options::="--force-confold" --allow-unauthenticated install postfix openmediavault


<<'COMMENT'
find /usr/local/backups -mtime +10 -name "*.deb" -exec rm -rf {} \;
find /media/volume1 -name "*@eaDir*" -exec rm -rf {} \;

deb https://packages.openmediavault.org/public usul main
deb https://openmediavault.github.io/packages/ usul main
# deb http://downloads.sourceforge.net/project/openmediavault/packages/ usul main
## Uncomment the following line to add software from the proposed repository.

deb http://packages.openmediavault.org/public/ usul-proposed main
deb https://openmediavault.github.io/packages/ usul-proposed main
# deb http://downloads.sourceforge.net/project/openmediavault/packages/ usul-proposed main
## This software is not part of OpenMediaVault, but is offered by third-party
## developers as a service to OpenMediaVault users.
deb http://packages.openmediavault.org/public/ usul partner
deb https://openmediavault.github.io/packages/ usul partner
# deb http://downloads.sourceforge.net/project/openmediavault/packages/ usul partner

apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 7E7A6C592EF35D13
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 24863F0C716B980B

deb https://dl.bintray.com/openmediavault-plugin-developers/usul buster main 
deb [arch=amd64] https://download.docker.com/linux/debian buster stable 
deb http://linux.teamviewer.com/deb stable main 
deb https://dl.bintray.com/openmediavault-plugin-developers/usul-extras buster main 

apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 7AA630A1EDEE7D73
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 7EA0A9C3F273FCD8
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com C5E224500C1289C0
COMMENT

